#include "userdata.h"

UserData::UserData(QObject *parent) :
    QObject(parent)
{
    username = "";
    password = "";
    privilege = -1;
}

void UserData::setUserName(QString un)
{
    username = un;
}

QString UserData::getUserName()
{
    return username;
}

// emphasis on hashed; password must be entered hashed
void UserData::setHashedPassword(QString hashedPw)
{
    password = hashedPw;
}

QString UserData::getHashedPassword()
{
    return password;
}

bool UserData::isAdmin()
{
    if (privilege == 0)
    {
        return false;
    }
    //emit noPrivilegeSet(); // what is this for?
    else if (privilege == 1)
    {
        return true;
    }
    return false;
}

/** TEST FUNCTION**/
void UserData::setPrivilege(int lvl)
{
    privilege = lvl;
}
